import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    dialogFormVisible:false,
    dialogVisible:false,
    dialogImgVisible:false,
    dialogEditVisible:false
  },
  mutations: {
    setOnVisible(state){
      state.dialogFormVisible=true;
    },
    setOffVisible(state){
      state.dialogFormVisible=false;
    },
    setOnFind(state){
      state.dialogVisible=true;
    },
    setOffFind(state){
      state.dialogVisible=false;
    },
    setOnImg(state){
      state.dialogImgVisible=true;
    },
    setOffImg(state){
      state.dialogImgVisible=false;
    },
    setOnEdit(state){
      state.dialogEditVisible=true;
    },
    setOffEdit(state){
      state.dialogEditVisible=false;
    },
  },
  actions: {
    visible({commit},dialog){
      if(dialog==false){
        commit('setOnVisible')
      }
      else{
        commit('setOffVisible')
      }
    },
    find({commit},dialog){
      if(dialog==false){
        commit('setOnFind')
      }
      else{
        commit('setOffFind')
      }
    },
    changeImg({commit},dialog){
      if(dialog==false){
        commit('setOnImg')
      }
      else{
        commit('setOffImg')
      }
    },
    editInfo({commit},dialog){
      if(dialog==false){
        commit('setOnEdit')
      }
      else{
        commit('setOffEdit')
      }
    }
  },
  modules: {}
});
